package com.web;

import com.service.ISubsidyManagementService;
import com.service.SubsidyManagementServiceImp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/SubsidyDelServlet")
public class SubsidyDelServlet extends HttpServlet {
    ISubsidyManagementService subsidyManagementService = new SubsidyManagementServiceImp();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String subsidyID = request.getParameter("subsidy_id");

        System.out.println("删除了项目id: " + subsidyID);


        boolean result = subsidyManagementService.delSubsidyById(subsidyID);

        if(result)
            response.getWriter().write("1");
        else
            response.getWriter().write("0");
    }
}
